<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
    
<%@ include file="/pages/jsp/internal/include.jsp" %>
 
<div class="inner_cont">

	<h2><fmt:message key="label.contentList"/></h2>
	
	<span class="note">
		
		<fmt:message key="page.contentList.description"/>
	
		<c:forEach items="${model.messages}" var="message">
			<div id="message"><fmt:message key="${message}"/></div>
		</c:forEach>
		
		<c:forEach items="${model.errors}" var="error">
			<div id="error">
				<fmt:message key="${error.key}">
					<fmt:param value="${error.param1}"/>
				</fmt:message>
			</div>
		</c:forEach>
		
	</span>

	<form  class="form" id="manageContentForm" method="post">
		
		<table  class="tableDati col tablesorter" id="tableContentList">
			<thead>
				<tr>
					<th width="30px"></th>
					<th width="120px" title="Titolo" >Titolo</th>
					<th width="120px" title="Strillo">Strillo</th>
					<th title="descrizione">Descrizione</th>
					<th width="80px" title="Data di inserimento">Data Ins</th>
					<th width="80px" title="Data inizio">Data inizio</th>
					<th width="80px" title="Data fine">Data fine</th>
					<th width="80px" title="Tipo di contenuto">Tipo</th>
					<th width="35px" title="Contenuto privato">PVT</th>
					<th width="50px" title="Contenuto con gallery">Gallery</th>
					<th width="30px" title="Contenuto con documenti associati">File</th>
					<th width="30px" title="Contenuto con immagini">Img</th>
				</tr>
			</thead>
			
			<tfoot>
				<tr>
					<th width="30px"></th>
					<th width="120px" title="Titolo" >Titolo</th>
					<th width="120px" title="Strillo">Strillo</th>
					<th title="descrizione">Descrizione</th>
					<th width="80px" title="Data di inserimento">Data Ins</th>
					<th width="80px" title="Data inizio">Data inizio</th>
					<th width="80px" title="Data fine">Data fine</th>
					<th width="80px" title="Tipo di contenuto">Tipo</th>
					<th width="35px" title="Contenuto privato">PVT</th>
					<th width="50px" title="Contenuto con gallery">Gallery</th>
					<th width="30px" title="Contenuto con documenti associati">File</th>
					<th width="30px" title="Contenuto con immagini">Img</th>
				</tr>
			</tfoot>
			
			<tbody>
				<c:forEach items="${model.contents}" var="content" varStatus="i">
					<tr>
						<td style="text-align:center">
							<input type="radio" name="id" value="<c:out value="${content.id}"/>" <c:if test="${i.index==0}">checked</c:if> >
						</td>
						
				   		<td><c:out value="${content.titolo}"/></td>
				   		
						<td><c:out value="${content.strillo}"/></td>
						
						<td>
							<div>
								<div class="tableTools" style="float:right;cursor:pointer" onclick="$('#description_<c:out value="${content.id}"/>').toggle('slow');">
									Vedi Tutto <img src="<c:url value="/css/images/minimalistica-icons/png/24x24/zoom_in.png"/>" title="Vedi tutto"/>
								</div>
								<c:out value="${fn:substring(content.descrizione,0,100)}" escapeXml="false"/>
							</div>
							<div style="display:none" id="description_<c:out value="${content.id}"/>">
								<c:out value="${content.descrizione}" escapeXml="false"/>
							</div>
						</td>
						
						<td style="text-align:center">	<fmt:formatDate pattern="dd/MM/yyyy" value="${content.insDate}" />		</td>
						<td style="text-align:center">	<fmt:formatDate pattern="dd/MM/yyyy" value="${content.startDate}" />	</td>
						<td style="text-align:center">	<fmt:formatDate pattern="dd/MM/yyyy" value="${content.endDate}" />		</td>
						
						<td style="text-align:center">
							<c:forEach items="${model.contentTypes}" var="contentType" varStatus="i">
							
								<c:if test="${content.fk_tipo_cont == contentType.id}">
									<c:out value="${contentType.descrizione}"/> 
								</c:if>
								
							</c:forEach>						
						</td>
						
						<td style="text-align:center">
							<c:choose>
								<c:when test="${content.hasPrivate == 1}">
									<img src="<c:url value="/css/images/minimalistica-icons/png/24x24/business_user.png"/>" title="Contenuto privato"/>
									<!--<c:out value="${content.hasPrivate}"/>-->
								</c:when>
								<c:otherwise>
									No
								</c:otherwise>
							</c:choose>
						</td>
						
						<td style="text-align:center">
							<c:choose>
								<c:when test="${content.hasGallery == 1}">
									<img src="<c:url value="/css/images/minimalistica-icons/png/24x24/photo_camera.png"/>" title="Contenuto con gallery"/>
									<!--<c:out value="${content.hasGallery}"/>-->
								</c:when>
								<c:otherwise>
									No
								</c:otherwise>
							</c:choose>
						</td>
						
						<td style="text-align:center">
							<c:choose>
								<c:when test="${content.hasFile == 1}">
									<img src="<c:url value="/css/images/minimalistica-icons/png/24x24/page_full.png"/>" title="Contenuto con documenti associati"/>
									<!--<c:out value="${content.hasFile}"/>-->
								</c:when>
								<c:otherwise>
									No
								</c:otherwise>
							</c:choose>
						</td>
						
						<td style="text-align:center">
							<c:choose>
								<c:when test="${content.hasImg == 1}">
									<img src="<c:url value="/css/images/minimalistica-icons/png/24x24/image.png"/>" title="Contenuto con immagini"/>
									<!--<c:out value="${content.hasImg}"/>-->
								</c:when>
								<c:otherwise>
									No
								</c:otherwise>
							</c:choose>
						</td>
						
				   	</tr>
			 	</c:forEach>
			 </tbody>
		</table>
		
		<div  id="pager" style="position:relative;top:0px">
			<form>
				<img src="<c:url value="/js/table/first.png"/>" class="first"/>
				<img src="<c:url value="/js/table/prev.png"/>" class="prev"/>
				<input type="text" class="pagedisplay"/>
				<img src="<c:url value="/js/table/next.png"/>" class="next"/>
				<img src="<c:url value="/js/table/last.png"/>" class="last"/>
				<select class="pagesize">
					<option selected="selected" value="10">10</option>
					<option value="20">20</option>
					<option value="30">30</option>
					<option value="40">40</option>
				</select>
			</form> 
		</div>
		
		<br/>
		
		<div class="action_bar">
			<input type="button" class="puls" value="Modifica" onclick="sendFormForAction('<c:url value="/content/modifyContentPage.htm"/>','manageContentForm','body','modify');"/>
			<input type="button" class="puls" value="Elimina" onclick="sendFormForAction('<c:url value="/content/deleteContent.htm"/>','manageContentForm','body','delete');"/>
		</div>
		
	</form>
</div>

<script type="text/javascript">
	$(document).ready(function() { 
		$("#tableContentList").tablesorter({
			widthFixed: true,
			dateFormat: "uk"
		}).tablesorterPager({container: $("#pager")});
	}); 
</script>

